-
Notifications
You must be signed in to change notification settings - Fork 300
feat: KSA support with AKS identity bindings #9687
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
|
Hi @qweeah. Thanks for your PR. I'm waiting for a github.com member to verify that this patch is reasonable to test. If it is, they should reply with Once the patch is verified, the new status will be reflected by the I understand the commands that are listed here. Instructions for interacting with me using PR comments are available here. If you have questions or suggestions related to my behavior, please file an issue against the kubernetes-sigs/prow repository. |
a9fd321 to
cfdc927
Compare
norshtein
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM
mainred
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I am not familiar with identity binding, but left some comments and hope they help.,
|
/ok-to-test |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Pull request overview
This PR adds support for Kubernetes Service Account (KSA) based authentication with identity bindings for the ACR credential provider, enabling secret-less ACR image pull via the Kubernetes API server's identity bindings endpoint for token exchange.
Key changes include:
- New identity bindings configuration parsing and validation with CLI flags (
--ib-sni-name,--ib-default-client-id,--ib-default-tenant-id,--ib-apiserver-ip) - Custom HTTP transport with SNI-based routing to configurable API server IP
- OAuth2 client credentials flow implementation using service account token exchange
- Comprehensive test coverage for configuration parsing and credential operations
Reviewed changes
Copilot reviewed 10 out of 10 changed files in this pull request and generated 9 comments.
Show a summary per file
| File | Description |
|---|---|
pkg/credentialprovider/identity_bindings_config.go |
Defines the IdentityBindingsConfig struct for identity bindings configuration |
pkg/credentialprovider/identity_bindings_credentials.go |
Implements identityBindingsTokenCredential with custom transport, SNI routing, and OAuth2 token exchange |
pkg/credentialprovider/identity_bindings_credentials_test.go |
Comprehensive unit tests for identity bindings credential creation and token retrieval |
pkg/credentialprovider/azure_credentials.go |
Updates NewAcrProvider to support identity bindings as the highest priority credential type |
pkg/credentialprovider/azure_credentials_test.go |
Updates existing tests to pass empty IdentityBindingsConfig parameter |
cmd/acr-credential-provider/pkg/config/identity_bindings_config.go |
Configuration parsing and validation logic with protocol prefix checks and mutual dependency enforcement |
cmd/acr-credential-provider/pkg/config/identity_bindings_config_test.go |
Unit tests for configuration parsing with 100% coverage of validation scenarios |
cmd/acr-credential-provider/main.go |
Adds CLI flags for identity bindings configuration |
cmd/acr-credential-provider/plugin.go |
Updates ExecPlugin to pass identity bindings config to credential provider |
cmd/acr-credential-provider/plugin_test.go |
Updates test to pass empty IdentityBindingsConfig |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
You can also share your feedback on Copilot code review for a chance to win a $100 gift card. Take the survey.
|
@qweeah please check UT, linting, etc locally. |
|
/retest |
|
Do we have unit tests to cover http proxy case? |
Added nil proxy check in the unit test @nilo19 |
Signed-off-by: Billy Zha <[email protected]>
|
/test pull-cloud-provider-azure-e2e-capz |
|
/lgtm |
|
[APPROVALNOTIFIER] This PR is APPROVED This pull-request has been approved by: clnv, mainred, nilo19, norshtein, qweeah The full list of commands accepted by this bot can be found here. The pull request process is described here
Needs approval from an approver in each of these files:
Approvers can indicate their approval by writing |
What type of PR is this?
/kind feature
What this PR does / why we need it:
This PR adds support for Kubernetes Service Account (KSA) based authentication with identity bindings for the ACR credential provider. This enables secret-less ACR image pull via the Kubernetes API server's identity bindings endpoint for token exchange.
Key Changes:
Configuration Enhancement:
cmd/acr-credential-provider/pkg/configpackage--ib-sni-name,--ib-default-client-id,--ib-default-tenant-id,--ib-apiserver-ipValidation Logic:
https://orhttp://prefixes in SNI namenet.ParseIPIdentity Bindings Token Credential:
Comprehensive Testing:
cmd/acr-credential-provider/pkg/config/identity_bindings_config_test.go) with 100% coveragepkg/credentialprovider/identity_bindings_credentials_test.go)Code Organization:
main.goto dedicated config packageWhich issue(s) this PR fixes:
Fixes #
Special notes for your reviewer:
API Server IP Configuration: The implementation uses a configurable API server IP (instead of hardcoded constant) to allow flexibility for different cluster configurations, though most AKS clusters use
10.0.0.1as the cluster-internal API server address.SNI-Based Routing: The custom dialer always resolves the SNI hostname to the configured API server IP, ensuring the TLS connection uses SNI for certificate validation while connecting to the correct cluster endpoint.
CA Certificate Rotation: The transport implementation detects CA certificate changes by comparing file content and rebuilds the transport with updated CA pool when rotation is detected.
Validation Strategy: The configuration validation enforces mutual dependencies (SNI name ↔ API server IP) to prevent misconfiguration. Protocol prefixes are rejected during parsing rather than being stripped.
Test Approach: The test suite uses
httptest.NewUnstartedServerwith self-signed certificates to test the full mTLS flow including custom dialer, TLS configuration, and token exchange logic.Tenant ID for Future SDK Compatibility: The
--ib-default-tenant-idparameter is included from day one to ensure smooth transition if the ACR credential provider switches to using the official Azure SDK in the future.Does this PR introduce a user-facing change?